package com.collect.collectclient.utils;

import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.xml.MappingJackson2XmlHttpMessageConverter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.List;

@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Override
    public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
        // 移除默认的 MappingJackson2XmlHttpMessageConverter
        converters.removeIf(converter -> converter instanceof MappingJackson2XmlHttpMessageConverter);
        // 添加自定义的 XML 消息转换器
        converters.add(new CustomXmlMessageConverter());
    }
}
